<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php include("db.php"); 	// Connect to the database server
dbConnect('kar_web1');   	// Use function in db.php to connect
include_once("http://02d2e0a.netsolhost.com/includes/timeout.php");?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Mass E-Mail Program</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php include("http://02d2e0a.netsolhost.com/includes/head.inc");  ?>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<div id="bodywidth">
<?php include("http://02d2e0a.netsolhost.com/includes/header.inc");  ?>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<?php include("http://02d2e0a.netsolhost.com/includes/leftmenu.php");
if (!isset($_SESSION['name']))
{ ?>
<div id="centercontent" style="width: 475px; height: auto">
<form method="GET" action="confirmlogin.php">
<table height="300px" width="100%" border=0 >
	<td align= center valign="top">
		<table height="300px" width="100%" border=0>
			<td align="center">
				<table width="100%" border=0>
				<td align="center">
				<font size=6>KAR Volunteer and Admin Login</font>
				</td>
			</td>
		</table>

		<br>

		<table width="400px" cellpadding="5%" border="0">
		<tr>
			<td align=right><font size=3><b>User Name:</b></font></td /align>
			<td><input type="text" name="user" size="20"></td>
		</tr>
		<tr>
			<td align=right><font size=3><b>Password:</b></td /align>
			<td><input type="password" name="password" size="20"></td>
		</tr>
		</table>

		<table width="100%" border="0">
		<tr>
			<td align=center><input type="submit" value="Login">
			
		</tr>
		</table>
	</td>
</table>
<?php 
}
else
{ ?>
<div id="centercontent" style="width: 475px; height: auto">
<script language="JavaScript">
//Validation to verify all fields are filled out...
function checkForm()
{
   var message, subject, email;
   with(window.document.register)
   {
      message = Message;
	  subject = Subject;
	  email = FromAddress;
   }
   //CHECKS ALL FIELDS FOR BLANKS
   if (trim(message.value) == "")
   {
      alert('Please enter a message!');
	  fname.focus();
   }
   else if(trim(subject.value) == "")
   {
      alert('Please enter a subject!');
	  ephone.focus();
   }
   else if(trim(email.value) == "")
   {
      alert('Please enter your E-Mail address!');
	  email.focus();
      {
	     document.register.submit();
      }
   }
}
function trim(str)
{
 return str.replace(/^\s+|\s+$/g,'');
}
</script>
<table cellpadding="1" cellspacing="1" border="1">

<form name="MassEmail" method="POST" enctype="multipart/form-data" action="emailer.php">

    <tr>
      <td>
        Your E-Mail:
      </td>
      <td>
        <input type="text" name="FromAddress" size="40">
      </td>
    </tr>
    <tr>
      <td>
        Subject:
      </td>
      <td>
        <input type="text" name="Subject" size="40">       
      </td>
    </tr>
    <tr>
      <td valign="top">
        Message:
      </td>
      <td>
        <TEXTAREA cols="45" rows="20" name="Message"></TEXTAREA>
      </td>
    </tr>
    <tr>
      <td colspan="2" align="center">
        <input type="submit" value="Send Mass Email" name="Send">
      </td>
    </tr>
</table>
</div>
<div id="rightcolumn">
<h4>Mail To:</h4><br />
<input type="checkbox" name="email[catfoster]">Cat Fosters<br />
<input type="checkbox" name="email[dogfoster]">Dog Fosters<br />
<input type="checkbox" name="email[catscreener]">Cat Screeners<br />
<input type="checkbox" name="email[dogscreener]">Dog Screeners<br />
<input type="checkbox" name="email[webteam]">Web Team<br />
<input type="checkbox" name="email[board]">Board Members<br />
<br />
<?php 
	$result = @mysql_query("SELECT * FROM volunteers WHERE volunteers.active='y' ORDER BY name");
	if (!$result) {
		echo("<p>Error performing query: " . mysql_error() . "</p>");
		exit();
	}
	while ( $row = mysql_fetch_array($result) ) 
	{
		echo("<input type=\"checkbox\" name=\"email[$row[name]]\">$row[name]<br />");
	}
echo("</form>");
	}?>
</div>
<? include("http://02d2e0a.netsolhost.com/includes/footer.inc");  ?>
</div>
</div>
</body>
</html>
